import java.util.StringJoiner;

/**
 * @author wang'ji'cheng
 * @date 2025/7/19
 */
public class StringJoinerDemo {
    public static void main(String[] args) {
        StringJoiner sj = new StringJoiner(",");
        StringJoiner add = sj.add("王").add("里").add("吗").add("6").add("草");
        String string = add.toString();
        System.out.println(string);

        //带开始和结束的
        System.out.println("带开始和结束的构造");
        StringJoiner sj1 = new StringJoiner(",", "[", "]");
        System.out.println(sj1.add("aaa").add("sss").add("fff"));
    }
}
